package com.fuyu.system.models.vo.user;

import com.fuyu.system.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
public class SysUserListVO {
    //用户ID
    @Schema(description = "用户ID")
    private Long userId;
    //部门ID
    @Schema(description = "部门ID")
    private Long deptId;
    //登录账号
    @Schema(description = "登录账号")
    private String username;

    //用户昵称
    @Schema(description = "用户昵称")
    private String nickname;
    //头像路径
    @Schema(description = "头像路径")
    private String avatar;
    //用户类型（00系统用户 01注册用户）
    @Schema(description = "用户类型（00系统用户 01注册用户）")
    private String userType;
    //用户邮箱
    @Schema(description = "用户邮箱")
    private String email;
    //手机号码
    @Schema(description = "手机号码")
    private String phone;
    //用户性别（0男 1女 2未知）
    @Schema(description = "用户性别（0男 1女 2未知）")
    private String gender;
    //盐加密
    @Schema(description = "盐加密")
    private String salt;
    //帐号状态（0正常 1停用）
    @Schema(description = "帐号状态（0正常 1停用）")
    private String status;

    //最后登录IP
    @Schema(description = "最后登录IP")
    private String loginIp;
    //最后登录时间
    @Schema(description = "最后登录时间")
    private Date loginDate;
    //密码最后更新时间
    @Schema(description = "密码最后更新时间")
    private Date pwdUpdateDate;
    //备注
    @Schema(description = "备注")
    private String remark;


    /**
     * 当前vo转entity
     */
    public static SysUserListVO toEntity(SysUser sysUser) {
        SysUserListVO sysUserVO = new SysUserListVO();
        sysUserVO.setUserId(sysUser.getUserId());
        sysUserVO.setDeptId(sysUser.getDeptId());
        sysUserVO.setUsername(sysUser.getUsername());
        sysUserVO.setNickname(sysUser.getNickname());
        sysUserVO.setAvatar(sysUser.getAvatar());
        sysUserVO.setUserType(sysUser.getUserType());
        sysUserVO.setEmail(sysUser.getEmail());
        sysUserVO.setPhone(sysUser.getPhone());
        sysUserVO.setGender(sysUser.getGender());
        sysUserVO.setSalt(sysUser.getSalt());
        sysUserVO.setStatus(sysUser.getStatus());
        sysUserVO.setLoginIp(sysUser.getLoginIp());
        sysUserVO.setLoginDate(sysUser.getLoginDate());

        return sysUserVO;
    }
}
